﻿using System.Configuration;
using System.Configuration.Provider;
using FileMonitor.Service.Configuration;
using FileMonitor.Service.Prototype;

namespace FileMonitor.Service.Provider.ProcessProvider
{
    public class FileMonitorProcessAppConfigProvider : FileMonitorProcessProviderBase
    {
        public override FileProcessProviderCollection GetAllProcess()
        {
            ProcessSection section = (ProcessSection)ConfigurationManager.GetSection("processProvider");

            if ((section == null) || (section.Processes == null) || (section.Processes.Count < 1))
            {
                throw new ProviderException("Def_dataService_provider_not_specified");
            }
            FileProcessProviderCollection s_Processes = new FileProcessProviderCollection();
            ProvidersHelper.InstantiateProviders(section.Processes, s_Processes, typeof(FileMonitorBase));

            return s_Processes;
        }
        public override void LockProcess(FileMonitorBase process)
        {

        }
        public override void Initialize(System.Collections.Specialized.NameValueCollection config)
        {
            base.Initialize(config);
        }
        private static FileMonitorProcessAppConfigProvider _instance = new FileMonitorProcessAppConfigProvider();

        public FileMonitorProcessAppConfigProvider() : base() { }
    }
}
